perm filename LINEN[MUS,SYS] blob sn#171243 filedate 1975-08-01 generic text, type T, neo UTF8
00100	With an ordinary OSCIL there is no simple way to  have  a  long  note
00200	keep  the  same  characteristics of attack and decay as a short note.
00300	The LINEN unit generator is used to create  envelopes  with  separate
00400	controls over attack time, decay time and steady state.
00500	
00600	
00700		  	  P7   P8   P9
00800		 	  |    |    |
00900		P4	  ↓    ↓    ↓        VAR
01000		| 	***************       | 
01100		|      *               *      |     LINEN	
01200		|     *                 *     |   U1 (UNIT GENERATOR ONE)
01300		---→ *        P5         * ←---
01400		    *                     * 
01500		   *                       *  
01600		  ***************************
01700			       |
01800			       | 	 MAG*P3
01900			       |         |
02000			       ↓         ↓
02100			     ***************
02200			     *             *    COSCIL
02300			     *             *    U2 (UNIT GENERATOR TWO)
02400		             *     P6      *
02500		              *           *       VARIABLE /VAR;
02600			       *         *	  COMPILE; 
02700			        *********  	  INSTRUMENT LIN;
02800			            |		  LINEN(P4,P7,P8,P9,P5,VAR);
02900			            ↓		  COSCIL(U1,MAG*P3,P6);
03000			          *****		  OUTA←OUTA+U2;
03100			         * OUT *	  END;
03200			         *  A  * 	  FINISH;
03250	
03275	
03300			          *****
03400	The parameter arrangement for LINEN is rather different from that for
03500	OSCIL.  The far left parameter (P4) is, as usual, an amplitude input.
03600	The next three (P7, P8  and  P9  in  this  particular  example)  will
03700	receive  the  attack  duration,  the  decay  duration  and  the total
03800	duration of the envelope, in  that  order.   The  next  item  in  the
03900	parameter  list  (P5 here) will contain the envelope array name.  The
04000	last item is a "run-time" variable which is  needed  to  ensure  that
04100	each note uses the correct portion of the overall envelope.
04200	
05100	The internal workings of LINEN make it unnecessary to use "MAG"  with
05200	the  3  time  domain  parameters.   The  proper conversion of time to
05300	increments is automatic.  The 3rd parameter (P9) of this group  could
05400	have  been  P2.  However since P2 is always a special parameter which
05500	tells how long the instrument is to be turned, its  use  to  indicate
05600	the  total  duration of the envelope would make it impossible to play
05700	several notes within one envelope cycle (a phrase.)
05800	
05900	The array used for LINEN must be defined in a special way.  Only  the
06000	first 2/3 of the available locations are to be used.  When using SEG,
06100	steps 1-25 are reserved for the attack portion, steps 26-50  for  the
06200	"steady  state"  and steps 51-75 for the decay portion.  Steps 76-100
06300	are ignored by LINEN but must be included in the SEG input  in  order
06400	for  the SEG routine to conclude properly.  To test the properties of
06500	LINEN it is best to construct an envelope with dramatic changes.
06600	
06700		ARRAY F2(512);
06800		SEG(F2); 0,1  1,2  .3,25  1,50  0,75  0,100;
06900	
07000	If parameters 7, 8 and 9 are set properly, this  array  will  give  a
07100	sharp  attack  followed  by  a  return to a low amplitude (.3) at the
07200	start of the "steady state"  section.   Following  there  will  be  a
07300	relatively  slow  crescendo to full amplitude and then a rapid decay.
07400	It must be emphasized that the sum of the values given for P7 and  P8
07500	(attack  and  decay)  must  never  exceed  the  value  of  P9  (total
07600	duration.) Likewise, P9 should never be less than P2, (the total time
07700	the instrument is turned on for a single note.) To visualize the true
07800	shape of the envelope for any particular note duration (ND)  consider
07900	that  the  time  spent in the middle section of the array (SS="steady
08000	state" area) will be what is left when the attack (AT) and decay (DK)
08100	are subtracted from the total duration (TD.)
08200	
08300		SS = TD - AT - DK
08400	
08500	To play the following notes add about 5k to your core image.
08600	
08700		PLAY; LIN 0 1 A 2000 F2 F1 .08 .08 1; VAR=0; FINISH;
08800	
08850	
08900	The special  variable  VAR  is  used  to  reset  a  pointer  for  the
09000	initialization  of  the envelope.  When a variable is declared with a
09100	preceding slash ( /VAR ) it is known as a "run-time" variable.   This
09200	means   that,  unlike  ordinary  parameters  which  are  read  by  an
09300	instrument only at the  beginning  of  a  note  (at  input  time,  or
09400	"I-time"),  a  "run-time"  variable  is  read or changed every time a
09500	sample is computed.  A unique variable must be used  for  each  LINEN
09600	unit  generator.    The  variable must be set to 0 immediately after!
09700	each detached note or after the first note of a phrase.
09750	
09800	In  the  following,  the 2 notes D, F will be connected (phrased) and
09900	the 3rd note, C#, will be detached.   Notice  that  the  first  value
10000	given  in  P9  (total  duration  of  envelope)  represents  the total
10100	duration of the first 2 notes.  P9 is changed to  equal  P2  for  the
10200	separate note.
10300	
10400		PLAY; LIN 0 .5 D 2000 F2 F1 .08 .08 1; VAR=0;
10500		LIN .5 .5 F;    < P4 to P9 remain the same.
10600		LIN  1 .5 CS 2000 F2 F1 .08 .08 .5; VAR=0;
10700		FINISH;
10800	
10900	
11000	
11100	You will have noticed that the last unit generator in this instrument
11200	is call a COSCIL.  This is exactly like  an  OSCIL  except  that  the
11300	pointer  to  the array is never re-initialized.  This allows the wave
11400	form produced to be continuous from one note to the next.   (The  "C"
11500	indicates it is a "continuing" OSCIL).  If an OSCIL were used in this
11600	situation clicks would often be heard between phased notes.
11700